package com.boc.langxiang.manager;

import android.content.Context;
import android.widget.ImageView;

import com.lzy.imagepicker.R;
import com.squareup.picasso.Picasso;

import java.io.File;


public class PicassoImageLoader {

    private PicassoImageLoader() {
    }

    private static PicassoImageLoader instance = new PicassoImageLoader();

    public static PicassoImageLoader getInstance() {
        return instance;
    }

    public void displayFileImage(Context context, String imageFilePath, ImageView imageView) {
        Picasso.with(context)
                .load(new File(imageFilePath))
                .placeholder(R.drawable.image_default)
                .error(R.drawable.image_default)
                .into(imageView);
    }

    public void displayUrlImage(Context context, String imageUrl, ImageView imageView) {
        Picasso.with(context)
                .load(imageUrl)
                .placeholder(R.drawable.image_default)
                .error(R.drawable.image_default)
                .into(imageView);
    }

    public void displyNoFileImage(Context context, String imageFilePath, ImageView imageView) {
        Picasso.with(context)
                .load(new File(imageFilePath))
                .noPlaceholder()
                .error(R.drawable.image_default)
                .into(imageView);
    }

}
